import request from '../../utils/request';

// 推荐问题管理相关 API

// 创建推荐问题
export const createRecommendedQuestion = (data: any) => {
    return request({
        url: '/system/api/recommended-question',
        method: 'post',
        data
    });
};

// 更新推荐问题
export const updateRecommendedQuestion = (data: any) => {
    return request({
        url: '/system/api/recommended-question',
        method: 'put',
        data
    });
};

// 更新推荐问题状态
export const updateRecommendedQuestionStatus = (id: string, status: number) => {
    return request({
        url: `/system/api/recommended-question/${id}/status`,
        method: 'put',
        params: { status }
    });
};

// 更新推荐问题排序
export const updateRecommendedQuestionSort = (id: string, sort: number) => {
    return request({
        url: `/system/api/recommended-question/${id}/sort`,
        method: 'put',
        params: { sort }
    });
};

// 增加推荐问题计数
export const incrementRecommendedQuestionCount = (id: string) => {
    return request({
        url: `/system/api/recommended-question/${id}/increment-count`,
        method: 'put'
    });
};

// 根据ID获取推荐问题
export const getRecommendedQuestionById = (id: string) => {
    return request({
        url: `/system/api/recommended-question/${id}`,
        method: 'get'
    });
};

// 分页查询推荐问题
export const getRecommendedQuestionPage = (params: any) => {
    return request({
        url: '/system/api/recommended-question/page',
        method: 'get',
        params
    });
};

// 获取启用的推荐问题
export const getEnabledRecommendedQuestions = () => {
    return request({
        url: '/system/api/recommended-question/enabled',
        method: 'get'
    });
};

// 删除推荐问题
export const deleteRecommendedQuestion = (id: string) => {
    return request({
        url: `/system/api/recommended-question/${id}`,
        method: 'delete'
    });
};
